package com.dcsgo.myTankGameClient;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;

/**
 * @author DCSGO
 * @version 1.0
 */

@SuppressWarnings({"all"})
public class MyTankGame extends JFrame {
    private MyPanel mp;
    public static String propertiesPath = "src/com/dcsgo/myTankGameClient/common/setting.properties";

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        MyTankGame myTankGame = new MyTankGame();
    }

    public MyTankGame() throws IOException, ClassNotFoundException {
        mp = new MyPanel();
        this.setSize(1000 + 16 + 260, 750 + 39);
        this.setVisible(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        this.add(mp);
        this.addKeyListener(mp);

        new Thread(mp).start();
        //添加 窗口监听器 用于监听关闭中
        this.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                //保存积分
                //保存坦克信息
                System.exit(0);
            }
        });

    }
}
